<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/

//前台
Route::get('/','Client\IndexController@index');
Route::get('test','Client\IndexController@test');

Route::group(['prefix' => 'client', 'namespace' => 'client'],function (){
    #获取作品信息
    Route::get('get','IndexController@getinfo');
    //发送手机验证码
    Route::get('registerPhone','LoginController@registerPhone');
    //发送手机兑换码
    Route::get('convertPhone','IndexController@convertPhone');
    //登录
    Route::get('toLogin','LoginController@index');
    Route::get('captcha', 'LoginController@captcha');
    Route::any('login','LoginController@login');
    //注册
    Route::get('toRegister','LoginController@toRegister');
    Route::post('register','LoginController@register');
    //重置密码
    Route::get('forgetPass','LoginController@forgetPass');
    Route::post('username','LoginController@username');
    Route::post('reset','LoginController@reset');
    //注销
    Route::get('logout','LoginController@logout');
//    //改密码
//    Route::get('toRePassword','LoginController@toRePassword');
//    Route::post('repassword','LoginController@rePassword');

    //详情页
    Route::get('goodsShow/{id}','IndexController@goodsShow');

    //更多商品
    Route::get('more/{id}','IndexController@moreGoods');

    //用户个人中心、账号管理、收藏列表
    Route::get('user','IndexController@user');
    Route::post('user/updateUser','IndexController@updateUser');
    Route::get('toChangePass','IndexController@toChangePass');

    #
    Route::any('user/updateAvatar','IndexController@updateAvatar');
    Route::post('user/changePass','IndexController@changePass');
    #
    Route::get('user/seeCollection','IndexController@seeCollection'); //查看收藏
    Route::get('user/cancelCollection','IndexController@cancelCollection'); //删除收藏
    #地址
    Route::post('toAddress','IndexController@toAddress');

    //购物车
    Route::get('showCart/{id}','IndexController@showCart');
    Route::post('toCart','IndexController@addCart');
    Route::any('delCart/{id}','IndexController@delCart');

    //单件订单确认
    Route::any('toOrder/{id}/{num}','IndexController@toOrder');
    Route::any('order','IndexController@order');

    //批量订单确认
    Route::any('toOrders','IndexController@toOrders');

    //兑换查询
    Route::get('query','IndexController@query');
    Route::get('findOrder','IndexController@findOrder');
    Route::any('search','IndexController@search');
    Route::get('delOrder/{id}','IndexController@delOrder');

    //兑换规则
    Route::get('rule','IndexController@rule');

});
//后台
Route::group(['prefix' => 'admin', 'namespace' => 'admin'], function() {
    Route::get('/', 'HomeController@index');
    Route::any('home', 'HomeController@home');
    Route::get('captcha', 'HomeController@captcha');
    Route::get('login','ManageController@login');
    Route::get('logout', 'HomeController@logout');
});
Route::group([ 'prefix' => 'admin', 'namespace' => 'admin','middleware'=>'admin'], function(){
    Route::any('home1', 'HomeController@home1');

    //管理员信息
    Route::any('admin/{id}','ManageController@admin');
    Route::post('edit','ManageController@edit');

    //下载模板
    Route::get('download',function() {
        return response()->download(
          realpath(base_path('public/')).'/users.xls','users.xls'
        );
    });

    //商品
    Route::get('goodsAdd','GoodsController@add');
    Route::post('goods/addGoods','GoodsController@goodsAdd');
    Route::post('goods/addqqq','OssClient@goodsAdd');
    Route::any('goodsList','GoodsController@index');
    Route::get('goods/getGoods/{id}','GoodsController@getGoods');
    Route::get('goods/delGoods/{id}','GoodsController@delGoods');
    Route::post('goods/updateGoods','GoodsController@updateGoods');
    Route::post('goods/batchDel','GoodsController@batchDel');

    //分类
    Route::get('categoryAdd','CategoryController@add');
    Route::post('category/addCategory','CategoryController@addCategory');
    Route::any('categoryList','CategoryController@index');
    Route::get('category/delCate/{id}','CategoryController@delCate');
    Route::get('category/getCate/{id}','CategoryController@getCate');
    Route::any('category/updateCate','CategoryController@updateCate');

    //管理员
    Route::any('manage', 'ManageController@index');
    Route::any('add', 'ManageController@add');
    Route::get('setStatus/{id}/{status}', 'ManageController@setStatus');
    Route::post('addManage', 'ManageController@addManage');
    Route::get('delManage/{id}', 'ManageController@delManage');
    Route::get('getManage/{id}', 'ManageController@getManage');
    Route::post('updateManage', 'ManageController@updateManage');
    Route::any('addChange','ManageController@addChange');
    Route::post('change','ManageController@change');

    //会员管理
    Route::any('users', 'UsersController@index');
    Route::get('users/CollectionList/{id}', 'UsersController@collectionList');
    Route::get('users/integralList/{id}', 'UsersController@integralList');
    Route::get('users/setStatus/{id}/{status}','UsersController@setStatus');
    Route::post('users/integralEdit','UsersController@integral');
    Route::any('userImp','UsersController@impUser');
    Route::any('userAdd','UsersController@add');
    Route::post('addUser','UsersController@addUser');
    Route::get('users/getUser/{id}','UsersController@getUser');
    Route::any('updateUser','UsersController@updateUser');
    Route::get('out/{batch}/{search}','UsersController@export');
    Route::get('out/{batch}','UsersController@exports');
    Route::get('addUser','UsersController@addUsers');
    Route::get('auditUsers','UsersController@auditUsers');
    Route::get('users/toAudit/{batch}','UsersController@toAudit');
    Route::get('users/del/{batch}','UsersController@delete');

    //添加订单
    Route::get('addBatch','OrdersController@addBatch');
    //批量审核
    Route::get('passAudit/{batch}','OrdersController@passAudit');

    #兑换服务
    Route::get('server','OrdersController@server');
    #导出订单信息
    Route::get('pull/{batch}','OrdersController@pull');

    //客户经理
    Route::any('dlist','ManageController@dlist');
    Route::any('director','ManageController@director');
    Route::post('addDirector','ManageController@addDire');
    Route::post('updateDirector','ManageController@updateDire');
    Route::get('getMan/{id}','ManageController@getMan');
    Route::get('delDire/{id}','ManageController@delDirector');

    //订单列表
    Route::any('orders1','OrdersController@index');//未完成订单
    Route::any('orders2','OrdersController@index2');//已完成订单
    Route::get('orderList/{id}','OrdersController@orderList');
    Route::get('orders/setStatus','OrdersController@setStatus');
    Route::get('orders/oneStatus/{id}/{status}','OrdersController@oneStatus');
    Route::get('orders/status','OrdersController@status');
    Route::any('orders/setAudit/{id}/{audit}','OrdersController@setAudit');
    //单条查询
    Route::any('select','OrdersController@select');
    //发送邮件
    Route::get('send','OrdersController@send');
    //客户经理批量提交
    Route::post('orders/import','OrdersController@import');
    Route::any('batch','OrdersController@batch');
    Route::any('audit1','OrdersController@audit');//未完成订单
    Route::any('audit2','OrdersController@audit2');//已完成订单
    Route::post('audits','OrdersController@audits');
    Route::get('hintPhone','OrdersController@hintPhone');
    Route::get('orders/toAudit/{batch}','OrdersController@toAudit');
    //删除
    Route::get('orders/del/{batch}','OrdersController@delete');

    //修改地址
    Route::get('chaAddre','OrdersController@chaAddre');

    //广告管理
    Route::any('ad','AdController@index');
    Route::get('ad/getAd/{id}','AdController@getAd');
    Route::any('ad/updateAd','AdController@updateAd');

    //标签管理
    Route::any('lable','LableController@index');
    Route::get('lable/getLable/{id}','LableController@getLable');
    Route::post('lable/updateLable','LableController@updateLable');

    //合作商管理
    Route::any('partner','PartnerController@index');
    Route::get('partner/getPartner/{id}','PartnerController@getPartner');
    Route::post('updatePartner','PartnerController@updatePartner');
    Route::get('partner/add','PartnerController@add');
    Route::post('addPartner','PartnerController@addPartner');
    Route::get('delPartner/{id}','PartnerController@delPartner');

    //兑换规则
    Route::get('rule','RuleController@ruleList');
    Route::post('rule/update','RuleController@update');

});


///**
// * 阿里云OSS
// */
//$app->group(
//    [
//        'prefix' => 'storage/oss',
//        'namespace' => 'Storage'
//    ],
//    function () use ($app) {
//        $app->post('upload/sign', 'OSSUploadController@sign'); #  OSS直传文件签名
//        $app->post('upload/callback', 'OSSUploadController@callback'); #  OSS直传文件回调
//
//        //$app->post('down', 'OSSController@download'); # 下载文件
//        //$app->post('delete', 'OSSController@delete'); # 删除文件
//        //$app->get('bucket', 'OSSBucketController@index'); # 查看全部存储空间
//    }
//);